﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using Common;

namespace Model
{
   [Serializable]
    public class exLayoutInfoForBuild : ICloneable
    {
       public string BuildName { get; set; }
       public string ControlName { get; set; }
       public string FullControlName { get; set; }
       public string InControl { get; set; }



       public enumLayoutTypeSimple Type { get; set; }

       private List<eProperty> _PropertyList;
       public List<eProperty> PropertyList
       {
           get
           {
               if (_PropertyList == null)
                   _PropertyList = new List<eProperty>();
               return _PropertyList;
           }
           set { _PropertyList = value; }
       }


       public object Clone()
       {
           using (MemoryStream ms = new MemoryStream(1000))
           {
               object CloneObject;
               BinaryFormatter bf = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone));
               bf.Serialize(ms, this);
               ms.Seek(0, SeekOrigin.Begin);
               // 反序列化至另一个对象（即创建了一个原对象的深表副本）
               CloneObject = bf.Deserialize(ms);
               // 关闭流 
               ms.Close();
               return CloneObject;
           }
       }

       public exLayoutInfoForBuild DeepCopy()
       {
           return (exLayoutInfoForBuild)Clone();
       }

    }
}
